import { PageParams, PageResult } from "@/types/global";
import type { BannerItem, CategoryItem, HotItem, RecommandItem } from "@/types/home";
import { httpRequest } from "@/utils/http";

// 获取轮播图信息
export const getHomeBannerAPI = (distributionSite = 1) => {
    return httpRequest<BannerItem[]>({
        method: 'GET',
        url: '/home/banner',
        data: { distributionSite },
    });
};

// 获取首页分类信息
export const getHomeCategoryAPI = () => {
    return httpRequest<CategoryItem[]>({
        method: 'GET',
        url: '/home/category/mutli',
    });
};

// 获取热门商品信息
export const getHomeHotAPI = () => {
    return httpRequest<HotItem[]>({
        method: 'GET',
        url: '/home/hot/mutli',
    });
};

// 获取推荐商品信息
export const getHomeRecommandAPI = (data?: PageParams) => {
    return httpRequest<PageResult<RecommandItem>>({
        method: 'GET',
        url: '/home/goods/guessLike',
        data,
    });
};